<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>XXXX-XX-XX-XX XX:XX:XX XXX</h1>
		
		<script type="text/javascript">
			var dayArray = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
			
			function showDate() {
				let time = new Date();
				let year = time.getFullYear();
				let month = format(time.getMonth() + 1);
				let day = format(time.getDate());
				let hour = format(time.getHours());
				let minute = format(time.getMinutes());
				let second = format(time.getSeconds());
				let week = dayArray[time.getDay()];
				let str = `${year}-${month}-${day} ${hour}:${minute}:${second} ${week}`;
				document.querySelector("h1").innerHTML = str;
			}

			function format(s) {
				return s < 10 ? "0" + s : s;
			}
			
			showDate(); // 立即执行一次避免初始空白
			setInterval(showDate, 500);
		</script>
	</body>
</html>